<%-- 
    Document   : edit
    Created on : Dec 27, 2011, 10:35:05 AM
    Author     : user
--%>

<%@page import="java.util.HashMap"%>
<%@page import="java.util.ArrayList"%>
<%@page import="Utils.Static"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@include file="../jspf/header.jspf" %>


<div style="width: 100%">
    <p class="pageTitle"><strong>Adauga produs</strong></p>
    <br />
    <p class="txt1">Formularul de mai jos va permite sa adaugati un produs
        nou pe VisionAlarm.ro</p>
    <hr />
</div>

<%@include file="../jspf/message.jspf" %>
<%
            HashMap product = (HashMap) session.getAttribute(Static.product);
%>

<form id="myform" method="POST" action="" >
    <div class="divReg">

        <table class="tableInfo txt1" style="line-height: 40px;">
            <tr>
                <td class="tableInfo c1"><label for="name">Nume produs</label></td>
                <td style="width: 3%; text-align: center;" class="style1"></td>
                <td class="tableInfo c3"><input type="text" id="name" name="name"
                                                size="32" maxlength="32"
                                                value="<%out.print(product.get("Name"));%>"/></td>
            </tr>
            <tr>
                <td class="tableInfo c1"><label for="description">Descriere</label></td>
                <td style="width: 3%; text-align: center;" class="style1"></td>
                <td class="tableInfo c3"><textarea id="description"
                                                   style="width: 217px; margin-top: 7px" name="description"><%out.print(product.get("Description"));%>
                    </textarea></td>
            </tr>

            <tr>
                <td class="tableInfo c1"><label for="price">Pret</label></td>
                <td style="width: 3%; text-align: center;" class="style1"></td>
                <td class="tableInfo c3"><input type="text" id="price" name="price" size="32" maxlength="32"  value="<% out.print(product.get("Price"));%>" /></td>
            </tr>

            <tr>
                <td class="tableInfo c1"><label for="price">Cantitate</label></td>
                <td style="width: 3%; text-align: center;" class="style1"></td>
                <td class="tableInfo c3"><input type="text" id="quantity" name="quantity" size="32" value="<%out.print(product.get("Quantity"));%>" /></td>
            </tr>
            <tr>
                <td class="tableInfo c1"><label for="price">categorie</label></td>
                <td style="width: 3%; text-align: center;" class="style1"></td>
                <td class="tableInfo c3"><select style="width: 220px"
                                                 name="categories"><%
                                                             ArrayList categories = (ArrayList) session.getAttribute(Static.categories);
                                                             session.setAttribute(Static.categories, null);

                                                             int size = categories.size();

                                                             for (int i = 0; i < size; i++) {
                                                                 HashMap row = (HashMap) categories.get(i);
                                                                 out.println("<option value=\"" + row.get("CategoryID") + "\">" + row.get("Name") + "</option>");
                                                             }
                                                             out.println("<script type=\"text/javascript\">"
                                                                     + "SetElementValue(\"categories\",\""
                                                                     + product.get("CategoryID") + "\") </script>");

                        %></select></td>
            </tr>



            <tr>
                <td class="tableInfo c1"></td>
                <td style="width: 3%; text-align: center;" class="style1"></td>
                <td class="tableInfo c3"><input type="submit" class="button"
                                                value="Salveaza" /></td>

        </table>

        <div class="txt1" style="width: 100%; margin-top: 10px">


            <hr />
        </div>

        <a href="admin/products" class="link">&laquo;&nbsp;Inapoi la lista</a></div>

</form>

<%@include file="../jspf/footer.jspf" %>

